EJB implementation class loading with removed dependencies with ability to replace EJB implementation class without full redeployment

ABSTRACT

A system and method for EJB classloading. By changing the EJB classloading scheme so that the EJB impl class is loaded in a child ClassLoader, the system allows the old EJB impl class to be replaced with a new one without disturbing the rest of the deployment. The key to doing this is to remove all direct references to the EJB impl class from classes loaded in the parent ClassLoaders. Removing this dependency allows the old EJB impl class to be replaced at any time with a new impl class.

CLAIM OF PRIORITY

This application claims priority to U.S. Provisional Patent Application 60/450,779, filed Feb. 28, 2003, entitled “SYSTEM AND METHOD FOR EJB CLASSLOADING”, and incorporated herein by reference.

COPYRIGHT NOTICE

A portion of the disclosure of this patent document contains material which is subject to copyright protection. The copyright owner has no objection to the facsimile reproduction by anyone of the patent document or the patent disclosure, as it appears in the Patent and Trademark Office patent file or records, but otherwise reserves all copyright rights whatsoever.

FIELD OF THE INVENTION

The invention relates generally to application servers and software development systems, and particularly to a system and method for EJB classloading.

BACKGROUND

The architecture of the traditional EJB classloading scheme is such that any changes to the EJB implementation (impl) class forces the developer to go through a full redeployment (undeploy and redeploy cycle) for the changes to take effect. This results in unnecessary work being done, since much of the EJB deployment code that had to execute has no direct dependency on the EJB impl class. One of the downsides is that it takes longer than necessary to have the new EJB impl changes take effect.

Another problem is that a full redeployment can be very disruptive, since it invalidates all references to the EJB and forces clients to obtain those references again to continue to invoke on the EJB.

SUMMARY

The invention provides a system and method for EJB classloading. By changing the EJB classloading scheme so that the EJB impl class is loaded in a child ClassLoader, the system makes it possible to replace the old EJB impl class with a new one without disturbing the rest of the deployment. The key to doing this is to remove all direct references to the EJB impl class from classes loaded in the parent ClassLoaders. Removing this dependency allows the old EJB impl class to be replaced at any time with a new impl class.

BRIEF DESCRIPTION OF THE FIGURES

FIG. 1 shows a classloading scheme used in a typical application server.

FIG. 2 shows a classloading scheme as used in accordance with an embodiment of the invention.

DETAILED DESCRIPTION

The invention provides a system and method for EJB classloading. The EJB classloading scheme is changed so that the EJB impl class* is loaded in a child ClassLoader. This allows us to replace the old EJB impl class with a new one without disturbing the rest of the deployment. (* by referring to EJB implementation class, this means the implementation class and all super classes).

The architecture of the traditional EJB classloading scheme is such that any changes to the EJB implementation (impl) class forces the developer to go through a full redeployment (undeploy and redeploy cycle) for the changes to take effect. This results in unnecessary work being done, since much of the EJB deployment code that had to execute has no direct dependency on the EJB impl class. One of the downsides is that it takes longer than necessary to have the new EJB impl changes take effect.

By changing the EJB classloading scheme so that the EJB impl class is loaded in a child ClassLoader, it is possible to replace the old EJB impl class with a new one without disturbing the rest of the deployment. The key to doing this is to remove all direct references to the EJB impl class from classes loaded in the parent ClassLoaders. Removing this dependency allows the old EJB impl class to be replaced at any time with a new impl class.

Implementing this, however, presents some unique challenges. First, one must ensure the EJB impl class is actually loaded in the child and not from the parent ClassLoader. This is achieved via a custom ClassLoader implementation in which the EJB impl class is specifically disallowed from being loaded in the parent ClassLoader. This is necessary because the parent ClassLoader has access to the EJB impl class along with the rest of the EJB classes since they are all packaged together.

Another challenge is ensuring none of the classes loaded in the parent ClassLoader have direct references to the classes loaded in the child ClassLoader. This is achieved by generating a custom interface for the EJB impl class, declaring all methods that are invoked on the EJB impl by the classes loaded in the parent ClassLoader. The classes in the parent ClassLoader then refer to the bean class interface instead of the bean class, and the direct dependency is removed.

FIG. 1 shows a classloading scheme used in a typical application server.

FIG. 2 shows a classloading scheme as used in accordance with an embodiment of the invention. Note that this example assumes the application only contains two EJBs—the techniques described herein can also be extended to support multiple-EJB applications. As shown in FIG. 2, each EJB impl class is loaded in a child ClassLoader. This makes it possible to replace the old EJB impl class with a new one without disturbing the rest of the deployment. All direct references to the EJB impl class from classes loaded in the parent ClassLoaders are removed.

The present invention may be conveniently implemented using a conventional general purpose or a specialized digital computer or microprocessor programmed according to the teachings of the present disclosure. Appropriate software coding can readily be prepared by skilled programmers based on the teachings of the present disclosure, as will be apparent to those skilled in the software art.

In some embodiments, the present invention includes a computer program product which is a storage medium (media) having instructions stored thereon/in which can be used to program a computer to perform any of the processes of the present invention. The storage medium can include, but is not limited to, any type of disk including floppy disks, optical discs, DVD, CD-ROMs, microdrive, and magneto-optical disks, ROMs, RAMs, EPROMs, EEPROMs, DRAMs, VRAMs, flash memory devices, magnetic or optical cards, nanosystems (including molecular memory ICs), or any type of media or device suitable for storing instructions and/or data.

The foregoing description of the present invention has been provided for the purposes of illustration and description. It is not intended to be exhaustive or to limit the invention to the precise forms disclosed. Many modifications and variations will be apparent to the practitioner skilled in the art. Particularly, it will be evident that while the examples described herein illustrate how the invention may be used in a WebLogic environment, other application servers, servers, and computing environments, may use and benefit from the invention. The code examples given are presented for purposes of illustration. It will be evident that the techniques described herein may be applied using other code languages, and with different code.

The embodiments were chosen and described in order to best explain the principles of the invention and its practical application, thereby enabling others skilled in the art to understand the invention for various embodiments and with various modifications that are suited to the particular use contemplated. It is intended that the scope of the invention be defined by the following claims and their equivalence. 

1. A system for EJB classloading comprising: a computer including an EJB stored thereon, said EJB having an EJB implementation class associated therewith; a parent classloader for loading EJB implementation class interfaces; a custom child classloader for loading the EJB implementation class such that all direct references to the EJB implementation class are removed from the parent classloader; and wherein dependencies of the EJB implementation class upon its parent classloader are removed such that the EJB implementation class is capable of being replaced with a new EJB implementation class in a computer readable medium without requiring full redeployment.
 2. The system of claim 1 wherein the custom classloader implementation used for the EJB implementation class is specifically disallowed from being loaded in the parent classloader.
 3. The system of claim 1 wherein a custom interface is generated for the EJB implementation class, wherein said custom interface declares all methods that are invoked on the EJB implementation class by the classes loaded in the parent classloader.
 4. The system of claim 3 wherein the classes in the parent classloader refer to the custom bean class interface.
 5. A method for EJB classloading comprising the steps of: providing a computer including an EJB stored thereon, said EJB having an EJB implementation class associated therewith; providing a parent classloader for loading EJB implementation class interfaces and a custom child classloader for loading the EJB implementation class; loading the EJB implementation class in a child classloader such that all direct references to the EJB implementation class from classes loaded in the parent classloaders are removed; and wherein dependencies of the EJB implementation class upon its parent classloader are removed such that the EJB implementation class is capable of being replaced with a new EJB implementation class in a computer readable medium without requiring full redeployment.
 6. The method of claim 5 wherein the custom classloader implementation used for the EJB implementation class is specifically disallowed from being loaded in the parent classloader.
 7. The method of claim 5 wherein a custom interface is generated for the EJB implementation class, wherein said custom interface declares all methods that are invoked on the EJB implementation class by the classes loaded in the parent classloader.
 8. The method of claim 7 wherein the classes in the parent classloader refer to the custom bean class interface.
 9. A computer readable medium including instructions stored thereon which when executed cause the computer to perform the steps of: providing a computer including an EJB stored thereon, said EJB having an EJB implementation class associated therewith; and, providing a parent classloader for loading EJB implementation class interfaces and a custom child classloader for loading the EJB implementation class; loading the EJB implementation class in the child classloader such that all direct references to the EJB implementation class from classes loaded in the parent classloaders are removed; and wherein dependencies of the EJB implementation class upon its parent classloader are removed such that the EJB implementation class is capable of being replaced with a new EJB implementation class in a computer readable medium without requiring full redeployment.
 10. The computer readable medium of claim 9 wherein the custom classloader implementation used for the EJB implementation class is specifically disallowed from being loaded in the parent classloader.
 11. The computer readable medium of claim 9 wherein a custom interface is generated for the EJB implementation class, wherein said custom interface declares all methods that are invoked on the EJB implementation class by the classes loaded in the parent classloader.
 12. The computer readable medium of claim 11 wherein the classes in the parent classloader refer to the custom bean class interface. 